package club.janna.rpcdemo.client.discover;

import club.janna.rpcdemo.domain.ServiceInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;

import javax.annotation.PostConstruct;
import java.util.*;

/**
 * 静态服务发现
 * 通过配置文件获取服务的信息
 */
public class StaticServiceDiscover extends AbstractServiceDiscover {

    @PostConstruct
    public void init() {
        serviceMap = new HashMap<>();
        List<ServiceInfo> userServiceList = new ArrayList<>();
        userServiceList.add(ServiceInfo.builder()
                .ip("127.0.0.1").port(12322)
                .protocol(ServiceInfo.Protocol.JAVA_SERIAL)
                .build());
        serviceMap.put("club.janna.rpcdemo.api.UserService", userServiceList);
    }


}
